package com.eian.boot.rabbit.core.sender;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnsCallback;

public class ReturnsCallbackImpl implements ReturnsCallback {

    private static final Logger logger = LoggerFactory.getLogger(ReturnsCallbackImpl.class);

    @Override
    public void returnedMessage(ReturnedMessage returned) {
        logger.error("消息发送失败已退回: Exchange={}, RoutingKey={}, ReplyCode={}, ReplyText={}",
                returned.getExchange(),
                returned.getRoutingKey(),
                returned.getReplyCode(),
                returned.getReplyText());
    }
}